#!/bin/bash

if [ "$USER" != "root" ];then
	echo "Need to be root"
	exit
fi
sudo apt install -y wget curl git
gw_iface=($(ip route |awk '$1=="default"{print $3,$5;exit}'))
if [ ! "${gw_iface[1]}" ];then
	echo "Not found default gateway"
	exit 1
fi

ip=$(ip -4 add list dev ${gw_iface[1]} |awk '$1=="inet"{print $2;exit}')

echo "address: $ip"
echo "gateway: ${gw_iface[0]}"
echo "install successfully, please restart system."
cd
git clone https://gitee.com/mfkd1000/ik.git
#wget -q https://gitee.com/mfkd1000/ik/raw/master/ikuai8.iso -O /root/ikuai8.iso
mv /root/ik/ikuai8.iso /root/ikuai8.iso
rm -rf /root/ik
sudo mount -o loop ikuai8.iso /mnt
sudo cp -rpf /mnt/boot /

#

echo "30秒内去vnc界面进入ikuai8启动安装"
echo "30秒内去vnc界面进入ikuai8启动安装"
echo "30秒内去vnc界面进入ikuai8启动安装"
rm -rf ubuntu_install_ikuai8.sh
sleep 30
reboot

